package com.zzzy.cont.vo.contract;

import com.zzzy.common.enums.YesOrNoEnum;
import com.zzzy.common.vo.PageParam;
import com.zzzy.cont.common.enums.ConStatusEnum;
import com.zzzy.cont.common.enums.TradeTypeEnum;
import com.zzzy.framework.common.annotation.RangeValuesCheck;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;

@Data
public class ConPageReq extends PageParam {

    @Schema(description = "合同名称")
    @Length(max = 100, message = "合同名称不能超过100个字符")
    private String name;

    @Schema(description = "合同编号")
    @Length(max = 50, message = "合同编号不能超过50个字符")
    private String conNo;

    @Schema(description = "订单编号")
    @Length(max = 100, message = "订单编号不能超过100个字符")
    private String orderNo;

    @Schema(description = "交易公司名称")
    @Length(max = 255, message = "交易公司名称不能超过255个字符")
    private String tradeCompany;

    @Schema(description = "交易类型：采购、销售")
    @RangeValuesCheck(enumValueRange = TradeTypeEnum.class, allowBlank = true, message = "交易类型填写错误")
    private String tradeType;

    @Schema(description = "合同类型")
    @Length(max = 100, message = "合同类型不能超过100个字符")
    private String conType;

    @Schema(description = "是否有固定期限(是/否)")
    @RangeValuesCheck(enumValueRange = YesOrNoEnum.class, allowBlank = true, message = "是否有固定期限填写错误")
    private String hasPeriod;

    @Schema(description = "合同状态：起草中、审核中、签订中、已归档、已废弃")
    @RangeValuesCheck(enumValueRange = ConStatusEnum.class, allowBlank = true, message = "合同状态填写错误")
    private String status;

    @Schema(description = "更新时间开始")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate beginUpdateTime;

    @Schema(description = "更新时间结束")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate endUpdateTime;

    @Schema(description = "排序字段")
    private String orderField;

    @Schema(description = "排序规则（正序：asc，倒序：desc）")
    private String orderRule;
}
